import { ReactNode } from 'react';
import { CommonProps } from '../common';
import { AccordionContentProps } from './AccordionContent';
import { AccordionTitleProps } from './AccordionTitle';

export interface AccordionOptions extends CommonProps {
  /**
   * 默认激活 ID
   */
  defaultId?: string | number;
  /**
   * 默认激活 ID；exclusive 为 false 时可用
   */
  defaultIds?: Array<string | number>;
  /**
   * 持续时长；单位：ms
   */
  duration?: number;
  /**
   * 风格样式
   */
  styled?: boolean | 'basic';
  /**
   * 树形
   */
  tree?: boolean;
  /**
   * 流体
   */
  fluid?: boolean;
  /**
   * 深色背景
   */
  inverted?: boolean;
  /**
   * 紧凑
   */
  compact?: boolean | 'very';
  /**
   * 只打开一个
   */
  exclusive?: boolean;
}

export interface AccordionTitleOptions extends CommonProps {
  /**
   * 激活
   */
  active?: boolean;
  /**
   * 唯一标志符
   */
  target: string | number;
  /**
   * 点击事件
   */
  onClick?: (e: MouseEvent) => void;
}

export interface AccordionContentOptions extends CommonProps {
  /**
   * 激活
   */
  active?: boolean;
  /**
   * 唯一标志符
   */
  id: string | number;
}

export type AccordionPanelTitleProps = Omit<AccordionTitleProps, 'active' | 'id'>;

export type AccordionPanelContentProps = Omit<AccordionContentProps, 'active' | 'id'>;

export interface AccordionPanelOptions {
  /**
   * 激活
   */
  active?: boolean;
  /**
   * 唯一标志符
   */
  id: string | number;
  /**
   * 标题
   */
  title?: AccordionPanelTitleProps | ReactNode;
  /**
   * 内容
   */
  content?: AccordionPanelContentProps | ReactNode;
  /**
   * 内容
   */
  children?: ReactNode;
}
